import httpInstance from "@/utils/http"

/**
 * 获取分类数据 /category?id=10020
 * @param {*} id
 * @returns
 */
export const getCategoryAPI = (id) => {
  return httpInstance({
    url: '/category',
    params: {
      id
    }
  })
}

/**
 * @description: 获取二级分类列表数据
 * @param {*} id 分类ID
 * @returns {*}
 */
export const getCategoryFilterAPI = (id) => {
  return httpInstance({
    url: '/category/sub/filter',
    params: {
      id
    }
  })
}

/**
 * @description: 获取导航数据
 * @data {
    categoryID: 100500,
    page: 1,
    pageSize: 20,
    sortField: 'publishTime' | 'orderNum' | 'evaluateNum',
  }
 * @returns {*}
 */
export const getSubCategoryAPI = (data) => {
  return httpInstance({
    url: '/category/goods/temporary',
    method: 'POST',
    data
  })
}
